package com.dalianpai.gulimall.order.controller;

import com.dalianpai.gulimall.order.entity.OrderReturnApplyEntity;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author WGR
 * @create 2020/7/27 -- 14:47
 */
@RestController
public class RabbitController {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @RequestMapping("sendMq")
    public String sendMq(){
        OrderReturnApplyEntity orderReturnApplyEntity = new OrderReturnApplyEntity();
        orderReturnApplyEntity.setId(1L);
        orderReturnApplyEntity.setCreateTime(new Date());
        orderReturnApplyEntity.setSkuName("wgr");
        rabbitTemplate.convertAndSend("hello-java-exchange","hello-java",orderReturnApplyEntity);
        return  "ok";
    }

}
